home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / utils / scrollsr.arc / scroll.src
Internet Message Format  |  1988-08-22  |  16KB

  1. From koreth@ssyx.ucsc.edu (Steven Grimm) Fri Aug 12 12:01:00 1988
  2. Path: caen.engin.umich.edu!mailrus!uwmcsd1!ig!agate!saturn!ssyx!koreth
  3. From: koreth@ssyx.ucsc.edu (Steven Grimm)
  4. Newsgroups: comp.sources.atari.st
  5. Subject: v01i070: scroll -- fast screen scroller
  6. Keywords: GST-assembler
  7. Message-ID: <4494@saturn.ucsc.edu>
  8. Date: 12 Aug 88 16:01 GMT
  9. Sender: usenet@saturn.ucsc.edu
  10. Lines: 443
  11. Approved: koreth@ssyx.ucsc.edu
  12.  
  13. Submitted-by: uunet!mcvax!philmds!leo (Leo de Wit)
  14. Posting-number: Volume 1, Issue 70
  15. Archive-name: scroll
  16.  
  17. The following program, when placed in the AUTO folder, speeds up scrolling
  18. (BIOS output only). Difference is most noticeable with relative few chars
  19. per line; speeds up full screen editors, 'more' utilities, etc.
  20. For all resolutions; not for GEM, only for TOS.
  21. The corresponding binary is sent to the moderator of comp.binaries.atari.st.
  22. The program was assembled and linked with the assembler and linker from the
  23. GST-C compiler.
  24.  
  25. For correspondence conceirning this program (bugs, questions etc.) try
  26.  
  27.       L. J. M. de Wit
  28.       Nachtegaallaan 7
  29.       5731XP Mierlo
  30.       Holland
  31.       e-mail: ..!mcvax!philmds!leo
  32.  
  33. ------------------------ s t a r t   h e r e ---------------------------------
  34. ******************************************************************************
  35. *                                                                            *
  36. *    scroll.asm  version 1.0 of 23 July 1988    (C) L.J.M. de Wit 1988       *
  37. *                                                                            *
  38. * This software may be used and distributed freely if not used commercially  *
  39. * and the originator (me) is mentioned.                                      *
  40. *                                                                            *
  41. ******************************************************************************
  42. *
  43. * NAME
  44. *    scroll - fast text scrolling
  45. *
  46. * SYNTAX
  47. *    scroll.prg
  48. *
  49. * DESCRIPTION
  50. *    Scroll provides for fast scrolling; this is achieved by using a 64K
  51. *    buffer for screen memory and changing the physical screen location therein.
  52. *    The actual changes take place at the receipt of certain escape codes or
  53. *    characters that would make the entire display scroll.
  54. *
  55. *    Scroll should be in the AUTO folder as SCROLL.PRG so that it is
  56. *    installed memory resident when the system is loaded.
  57. *
  58. * DECISIONS
  59. *    The extra storage needed grabs a 33K from your free mem, unless
  60. *    the memory cannot be reserved adjacent to the original screen memory,
  61. *    in which case 65K is needed.
  62. *    The console output vector at 4a8 is used to trap the escape codes.
  63. *    Also the bios vector had to be changed (a pity);
  64. *    this is only needed to be able to load from AUTO folders:
  65. *    the con_state vector is reinitiated when the resolution changes
  66. *    The program must reside in the current drive's AUTO folder to be able
  67. *    to find itself.
  68.  
  69.       module  scroll
  70.       section s.ccode
  71.  
  72. * character codes
  73. lf       equ   10
  74. vt       equ   11
  75. ff       equ   12
  76. cr       equ   13
  77. esc      equ   27
  78.  
  79. * scrinfo offsets
  80. maxcol   equ   0
  81. maxrow   equ   2
  82. bprow    equ   4
  83. scrad    equ   10
  84. col      equ   16
  85. row      equ   18
  86. flag     equ   38
  87.  
  88. * system variables
  89. v_bas_ad   equ   $44e
  90. con_state  equ   $4a8
  91.  
  92. * GEMDOS & (X)BIOS stuff
  93. gemdos   equ   1
  94. bios     equ   13
  95. xbios    equ   14
  96. ptermres equ   $31
  97. supexec  equ   38
  98. setexc   equ   5
  99. setscreen equ  5
  100. physbase equ   2
  101. setblock equ   $4a
  102. pexec    equ   $4b
  103.  
  104. * divers
  105. bpaglen  equ   $100
  106. textlen  equ   12
  107. datalen  equ   20
  108. bsslen   equ   28
  109. linea0   equ   $a000
  110.  
  111. scrinit
  112.       move.l   4(sp),a3          * basepage start
  113.       move.l   #bpaglen,d3       * base page length
  114.       add.l    textlen(a3),d3    * + text length
  115.       add.l    datalen(a3),d3    * + data length
  116.       add.l    bsslen(a3),d3     * + bss length
  117.       add.l    #256,d3           * + rounding length
  118.       move.w   #physbase,-(sp)
  119.       trap     #xbios
  120.       addq.l   #2,sp
  121.       move.l   d0,a4             * Start physical screen memory
  122.       dc.w     linea0
  123.       suba.w   #44,a0
  124.       lea.l    scrinfo(pc),a1
  125.       move.l   a0,(a1)           * start screen info to scrinfo
  126.       move.l   a0,a2             * and also a2
  127.       move.w   maxrow(a2),d1
  128.       addq.l   #1,d1
  129.       mulu.w   bprow(a2),d1      * screen size into d1
  130.       lea.l    8(sp),a0
  131.       cmpa.l   a4,a0
  132.       bne.s    scrinstall        * last location not start of phys. screen mem.
  133.       tst.b    128(a3)
  134.       bne.s    scrinstall        * Prog. had argument: called the second time
  135.       add.l    d1,d3             * add a screen size
  136.       sub.l    d3,a0             * this will be taken off current prog area
  137.       move.l   a0,sp
  138.       suba.l   a3,a0
  139.       move.l   a0,-(sp)
  140.       move.l   a3,-(sp)
  141.       move.w   #0,-(sp)
  142.       move.w   #setblock,-(sp)
  143.       trap     #gemdos           * Leaving just enough for next load of myself
  144.       lea.l    12(sp),sp
  145.       pea      nullstr
  146.       pea      argstr
  147.       pea      progname
  148.       move.w   #0,-(sp)
  149.       move.w   #pexec,-(sp)
  150.       trap     #gemdos           * load & exec myself with a nonzero arglist
  151.       lea.l    12(sp),sp
  152.       clr.w    -(sp)
  153.       trap     #gemdos           * finished
  154.  
  155. scrinstall
  156.       lea.l    8(sp),a0
  157.       cmpa.l   a4,a0
  158.       bne.s    notattop          * current mem not adjacent to phys. screen mem.
  159. attop
  160.       suba.l   a3,a0
  161.       move.l   a0,d3             * d3 : just all we've got
  162.       lea.l    topbase(pc),a0
  163.       move.l   a4,(a0)           * current phys screen mem becomes top base
  164.       sub.l    d1,a4
  165.       lea.l    botbase(pc),a0    * and botbase a screen 'lower'
  166.       move.l   a4,(a0)
  167.       bra.s    endcalc
  168. notattop
  169.       move.l   a3,d0
  170.       add.l    d3,d0
  171.       clr.b    d0                * Adjust for 256 byte boundary
  172.       lea.l    botbase(pc),a0
  173.       move.l   d0,(a0)           * address lowest screen
  174.       add.l    d1,d0             * a screen 'higher'
  175.       lea.l    topbase(pc),a0
  176.       move.l   d0,(a0)           * address highest screen
  177.       add.l    d1,d3             * add a screen's length to mem needed
  178.       add.l    d1,d3             * and another one
  179. endcalc
  180.       pea      setvect(pc)
  181.       move.w   #supexec,-(sp)
  182.       trap     #xbios            * set new console output vector
  183.       addq.l   #6,sp
  184.       pea      newbios(pc)
  185.       move.w   #$2d,-(sp)
  186.       move.w   #setexc,-(sp)
  187.       trap     #bios             * Set new BIOS vector
  188.       addq.l   #8,sp
  189.       lea.l    oldbios(pc),a0
  190.       move.l   d0,(a0)           * Save old one
  191.       move.l   topbase(pc),d0
  192.       move.w   #-1,-(sp)
  193.       move.l   d0,-(sp)
  194.       move.l   d0,-(sp)
  195.       move.w   #setscreen,-(sp)
  196.       trap     #xbios            * make highest screen current
  197.       lea.l    12(sp),sp
  198.       clr.w    -(sp)             * return value: 0 for success
  199.       move.l   d3,-(sp)          * # bytes to keep
  200.       move.w   #ptermres,-(sp)   * keep process
  201.       trap     #gemdos           * stops here...
  202.  
  203. * New bios routine; only sets con_state to point to newconsole if not already
  204. * saving the old value.
  205. newbios
  206.       lea.l    newconsole(pc),a0
  207.       cmpa.l   con_state,a0
  208.       beq.s    newsame
  209.       bsr      setvect           * Set con_state if it was not newconsole
  210. newsame
  211.       movea.l  oldbios(pc),a0
  212.       jmp      (a0)
  213.  
  214. * This is the routine that con_state will always point to, except
  215. * when printing characters from within the routine itself.
  216. newconsole
  217.       move.l   cvsav(pc),con_state * restore original vector
  218.       move.w   d1,-(sp)          * save character to be printed on the stack
  219.       movea.l  scrinfo(pc),a1
  220.       lea.l    hadesc(pc),a0
  221.       tst.b    (a0)
  222.       beq.s    noesc             * If previous char was not escape; else ...
  223.       sf.b     (a0)              * Reset escape flag
  224.       tst.w    row(a1)
  225.       bne.s    no_0row           * If cursor not on row 0
  226.       cmp.w    #'I',d1
  227.       bne.s    not_i             * If not ESC I
  228.       bsr      scr_down          * else scroll down
  229.       move.w   #esc,d1
  230.       bsr      charout           * and print the ESC
  231.       move.w   #'I',d1
  232.       bsr      charout           * and the I
  233.       bra      newdone
  234. not_i
  235.       cmp.w    #'L',d1
  236.       bne.s    not_l